<!-- Modal -->
<#include "../../select.ftl"/>
<#assign shmsConstant = statics["cn.hfatec.shms.constants.ShmsConstant"]/>
<div class="modal-body">
    <div id="errorMessage"><#include "../../message.ftl" /></div>
    <form class="form-horizontal" role="form" id="organizationForm" method="post"
          action="${absoluteContextPath}/system/organization/save">
    <#if organization??>
        <#if organization.id??>
            <input type="hidden" name="id" value="${organization.id}"/>
        <#else>
            <input type="hidden" name="id" value=""/>
        </#if>
    </#if>
        <div class="row">
            <input name="orgId" value="${(organization.orgId)!''}" type="hidden" class="form-control"/>

            <div class="form-group col-md-12">
                <label class="col-sm-4 control-label">机构名称<sup style="color: red">*</sup></label>

                <div class="col-sm-6">
                    <input name="orgName" value="${(organization.orgName)!''}" type="text" class="form-control"/>
                </div>
            </div>
            <div class="form-group col-md-12">
                <label class="col-sm-4 control-label">上级机构ID<sup style="color: red">*</sup></label>

                <div class="col-sm-6">
                    <input name="parentOrgId" value="${(organization.parentOrgId)!''}" type="text" readonly="readonly"
                           class="form-control"/>
                </div>
            </div>
            <div class="form-group col-md-12">
                <label class="col-sm-4 control-label">机构级次<sup style="color: red">*</sup></label>

                <div class="col-sm-6">
                    <input name="orgLevel" value="${(organization.orgLevel)!''}" type="text" readonly="readonly"
                           class="form-control"/>
                </div>
            </div>
            <div class="form-group col-md-12">
                <label class="col-sm-4 control-label">机构级次码</label>

                <div class="col-sm-6">
                    <input name="orgLevelCode" value="${(organization.orgLevelCode)!''}" type="text" readonly="readonly"
                           class="form-control"/>
                </div>
            </div>
            <div class="form-group col-md-12">
                <label class="col-sm-4 control-label">是否医院<sup style="color: red">*</sup></label>

                <div class="col-sm-6">
                <@select list=isHospitalList value="${(organization.isHospital)!0}" name="isHospital" class="form-control"/>
                </div>
            </div>
        <#if (organization.isHospital)?? && organization.isHospital == shmsConstant.IS_HOSPITAL_YES>
        <div class="form-group col-md-12" id="orgAnotherName">
        <#else>
        <div class="form-group col-md-12" id="orgAnotherName" style="display: none">
        </#if>
            <label class="col-sm-4 control-label">机构别名</label>

            <div class="col-sm-6">
                <input name="orgAnotherName" value="${(organization.orgAnotherName)!''}" type="text"
                       class="form-control"/>
            </div>
        </div>
            <div class="form-group col-md-12">
                <label class="col-sm-4 control-label">排序号</label>

                <div class="col-sm-6">
                    <input name="sortNo" value="${(organization.sortNo)!''}" type="text" class="form-control"/>
                </div>
            </div>
            <div class="form-group col-md-12">
                <label class="col-sm-4 control-label">备注</label>

                <div class="col-sm-6">
                    <textarea name="remark" rows="6" cols="25"
                              style="width: 100%">${(organization.remark)!''}</textarea>

                </div>
            </div>
            <div class="form-group col-md-12">
                <label class="col-sm-4 control-label"></label>

                <div class="col-sm-6">
                    <button type="button" class="btn btn-primary" onclick="save();">保存</button>
                </div>
            </div>
        </div>
    </form>
</div>
<script>
    $(function () {
        $("#organizationForm").find("select[name=isHospital]").chosen({disable_search_threshold: 10}).change(function () {
            if ($(this).val() == '${shmsConstant.IS_HOSPITAL_YES}') {
                $('#orgAnotherName').show();
            } else {
                $('#orgAnotherName').hide();
            }
        });
    });
</script>
